﻿define(['jquery'], function ($, OrderServiceProxy) {
    var apiPath = "http://localhost/OrderServiceLevel1/";

    if (!OrderServiceProxy) {
        OrderServiceProxy = {}
    };

    OrderServiceProxy.getOrders = function (proxyData) {
        var url = apiPath + "GetOrders";

        $.getJSON(url, proxyData.success);
    };

    OrderServiceProxy.createOrder = function (proxyData) {
        var url = apiPath + "SubmitOrder";

        $.getJSON(url, proxyData.data, proxyData.success);
    },

    OrderServiceProxy.deleteOrder = function (proxyData) {
        var url = apiPath + "CancelOrder";

        $.getJSON(url, proxyData.data, proxyData.success);
    },

    OrderServiceProxy.getOrderById = function (proxyData) {
        var url = apiPath + "GetOrderDetails";

        $.getJSON(url, proxyData.data, proxyData.success);
    },

    OrderServiceProxy.updateOrder = function (proxyData) {
        var url = apiPath + "UpdateOrder";

        $.getJSON(url, proxyData.data, proxyData.success);
    }

    return OrderServiceProxy;
});